package app.actions;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *  Akce ukonceni aplikace
 * @author Dejvino
 */
public class ExitAction extends AbstractAction {

    private JFrame window = null;

    public ExitAction(JFrame window){
        this.window = window;
    }

    public void actionPerformed(ActionEvent ae) {
        if(JOptionPane.showConfirmDialog(null,
                java.util.ResourceBundle.getBundle("app/frames/language").getString("ReallyQuitMSG"),
                java.util.ResourceBundle.getBundle("app/frames/language").getString("QuestionMSG"),
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == 0){
            if(window != null){
                window.setVisible(false);
                window.dispose();
            }
        }
    }

}
